package com.hzw.saas.service.storage.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

/**
 * 配置参数类
 *
 * @author zzl
 * @since 12/28/2020
 */
@Component
@ConfigurationProperties(prefix = "saas.storage", ignoreInvalidFields = true, ignoreUnknownFields = true)
@Validated
@Data
public class StorageConfig {

    /**
     * 文件存储单文件最大长度
     */
    private long fileMaxSize = 1024 * 1024 * 1024L;

    /**
     * aliyun or aws
     */
    private String s3Service = "aliyun";

    /**
     * 默认个人空间catalog
     */
    private String personalSpaceCatalog = "storage/personal";

    /**
     * 默认个人空间缓存catalog，如文件分片等
     */
    private String personalSpaceCacheCatalog = "storage/pCache";

    /**
     * 默认工作空间catalog
     */
    private String workSpaceCatalog = "storage/work";

    /**
     * 默认工作空间缓存catalog，如文件分片等
     */
    private String workSpaceCacheCatalog = "storage/wCache";

    /**
     * 文件上传目录，相对（相对于classpath）或绝对路径
     * 备用
     */
    private String folderPath = "upload/cache/";

    /**
     * 缩略图尺寸
     */
    private int thumbnailSize = 512;

    /**
     * 需生成缩略图的图片长度阈值（大于该值需要生成缩略图）
     */
    private long thumbnailThreshold = 200 * 1024;

    /**
     *
     */
    private String thumbnailSizeDelimiter = ",";

}
